<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Jobs\SendSms as SendSmsJob;
use Illuminate\Support\Facades\Log;

class SendSms extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'sendsms';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'send sms';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
        Log::info('sms定时任务已启动');

        for ($i = 0; $i < 5; $i++) {
            $res = dispatch((new SendSmsJob($i))->onQueue('sms'));
        }
    }
}
